# 预设的用户名和密码
valid_username = "admin"
valid_password = "password"


def login():
    while True:
        # 获取用户输入的用户名和密码
        username = input("请输入用户名: ")
        password = input("请输入密码: ")

        # 验证用户名和密码
        if username == valid_username and password == valid_password:
            print("登录成功！")
            break
        else:
            print("用户名或密码错误，请重试。")


if __name__ == "__main__":
    login()